<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class GoodsDoaddRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
           'gname'=>'required',
           'gprice'=>'required',
           'gpic'=>'required',
           'gintro'=>'required'
           'gurl'=>'required',
           'gsrc'=>'required'
           // 'phone'=>'required|regex:/\d{11}/',
        ];
    }

    public function messages()
    {
        return [
            'gname.required' => '商品名不能为空',
            'gprice.required' => '价格不能为空',
            'gpic.required' => '请上传商品主图',
            'gintro.required' => '请填写商品描述',
            'gurl' => '商城字段不能为空',
            'gsrc' => '商品网址不能为空'
        ];
    }
}
